package com.df.client;

import com.df.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: codes
 * @description:
 * @author: df
 * @create: 2023-07-10 14:29:42
 **/
@FeignClient("PRODUCT")
public interface ProductClient {

    @GetMapping("/product")
    public String product();

    /*
    * 1.离散参数传递
    *   1.1 queryString 传参 eg:http://localhost:8888/test?id=1&name=df
    *   1.2 路径传参 eg: http://localhost:8888/{id}/{name}
    * */
    @GetMapping("/test")
    public String test(@RequestParam int id,@RequestParam String name);

    @GetMapping("/test1/{id}/{name}")
    public String test1(@PathVariable int id, @PathVariable String name);

    /*
    * 2.对象传参
    * */
    @PostMapping("/product1")
    public String product(@RequestBody Product product);

    /*
    * 3.数组和集合
    *
    * */
    @PostMapping("/array")
    public String array(@RequestParam Integer[] ids);

    /*
    * 2.数据响应
    *
    * */
    @GetMapping("/get")
    public Product get(@RequestParam int id);
}
